package com.newblog.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.newblog.dao.TagDAO;
import com.newblog.factory.TagDaoFactory;
import com.newblog.model.Tag;
import com.newblog.model.User;

public class TagAction extends DispatchAction {

	public ActionForward listTags(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		User user = (User)request.getSession().getAttribute(UserAction.SESSION_KEY);
		Tag tag = new Tag();
		tag.setId(user.getId());
		TagDAO tagDAO = TagDaoFactory.getInstance().createTagDAO();
		List tags =  tagDAO.getTagList(tag);
		request.setAttribute("tags", tags);
		return null;
	}
	public ActionForward updateTags(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		return null;
	}
	public ActionForward deleteTag(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		return null;
	}
	
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		return super.execute(mapping, form, request, response);
	}

}
